#include "quirrel_editor_extension.hpp"
#include "quirrel_function_extension.hpp"
#include "scripting/scripting_module.h"
#include "utils/log.hpp"

bool ModuleInit()
{
    L_INFO("Quirrel Scripting Module Init...");
    return true;
}

void ModuleCleanup()
{
    L_INFO("Quirrel Scripting Module Cleanup...");
}

IScript* BuildScript(const ScriptBuildInfo *info)
{
    RC_ERROR(nullptr, !(info && info->Valid()), "Invalid Script Build Info Passed!!!");

    if (strcmp(info->usage, "editor") == 0) {
        return QuirrelEditorExtension::create(EditorTargetFromString(info->usage_extra), info->title, info->file_path, info->code);
    } else if (strcmp(info->usage, "function") == 0) {
        return QuirrelFunctionExtension::create(info->title, info->file_path, info->code);
    }

    return nullptr;
}
